using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using IGlobalist.Chat.Engine;
using IGlobalist.Cms.Common;

namespace IGlobalist.Cms.Chat
{
    public partial class ChatLogin : ChatBasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnLogin_Click(object sender, EventArgs e)
        {
            string username = txtUsername.Text;
            string password = txtPassword.Text;
            Room room = RoomConfig.GetChatRoom(hdnRoomID.Value);
            if (room.Administrator.UserName.Equals(username, StringComparison.OrdinalIgnoreCase) &&
                    room.Administrator.Password.Equals(password))
            {
                Session[SessionVariable.Chat.CurrentAdmin + room.ID] = room;
                Response.Redirect("Public.aspx?rid=" + room.ID, true);
            }
        }
    }
}
